package cn.gok.homework;

import java.io.File;

public class FileExam {
    public static void main(String[] args) {
        File file = new File("F:\\java_workspace\\day4\\src");
        showDir(file);
    }

    private static void showDir(File srcFile) {
        File[] files = srcFile.listFiles();
        for (File file1:files){
            if (file1.isDirectory()){
                //判断是否是文件夹
                showDir(file1);
            }else {
                if (file1.getName().endsWith(".java")){
                    //输出该文件的路径
                    System.out.println(file1.getAbsolutePath());
                }
            }
        }
    }
}
